package com.software.loginregister.fragment.homecategoryfragment;

import android.content.Intent;
import android.os.Bundle;

import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.software.loginregister.R;
import com.software.loginregister.activity.DrinkActivity;
import com.software.loginregister.activity.HealthCardActivity;
import com.software.loginregister.activity.WeightLossActivity;

public class NutritionalDietFragment extends Fragment {

    private CardView cardWeightLoss;
    private CardView cardHealth;
    private CardView cardDrink;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_nutritional_diet, container, false);

        initViews(view);
        setupListeners();

        return view;
    }

    private void initViews(View view) {
        cardWeightLoss = view.findViewById(R.id.card_weight_loss);
        cardHealth = view.findViewById(R.id.card_health);
        cardDrink = view.findViewById(R.id.card_drink);
    }

    private void setupListeners() {
        cardWeightLoss.setOnClickListener(v -> {
            // 跳转到瘦身减脂详情页
            startActivity(new Intent(getActivity(), WeightLossActivity.class));
        });

        cardHealth.setOnClickListener(v -> {
            // 跳转到健康养生详情页
            startActivity(new Intent(getActivity(), HealthCardActivity.class));
        });

        cardDrink.setOnClickListener(v -> {
            // 跳转到清凉茶饮详情页
            startActivity(new Intent(getActivity(), DrinkActivity.class));
        });
    }
}